home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / flilib.zip / AAFLI.H < prev    next >
C/C++ Source or Header  |  1990-02-20  |  3KB  |  114 lines

  1. /* aafli.h  Copyright 1990 Dancing Flame, San Francisco */
  2.  
  3. #ifndef AAFLI_H
  4. #define AAFLI_H
  5.  
  6. #ifndef AATYPES_H
  7. #include "aatypes.h"
  8. #endif /* AATYPES_H */
  9.  
  10. #ifndef AADOS_H
  11. #include "aados.h"
  12. #endif /* AADOS_H */
  13.  
  14. #ifndef AAERR_H
  15. #include "aaerr.h"
  16. #endif /* AAERR_H */
  17.  
  18. #ifndef AASCREEN_H
  19. #include "aascreen.h"
  20. #endif /* AASCREEN_H */
  21.  
  22.  
  23. #define FLI_MAXFRAMES (4*1000)        /* Max number of frames... */
  24. #define FLIH_MAGIC 0xaf11             /* File header Magic */
  25. #define FLIF_MAGIC 0xf1fa            /* Frame Magic */
  26.  
  27. typedef struct fli_head
  28.     {
  29.     long size;
  30.     USHORT type;                      /* = FLIH_MAGIC */
  31.     USHORT frame_count;
  32.     USHORT width;
  33.     USHORT height;
  34.     USHORT bits_a_pixel;
  35.     SHORT flags;
  36.     SHORT speed;
  37.     long next_head;
  38.     long frames_in_table;
  39.     int file;            /* used by players.  Contains zeros on disk. */
  40.     long frame1_off;    /* used by players.  Contains zeros on disk. */
  41.     long strokes;        /* how many paint strokes etc. made. */
  42.     long session;         /* stokes since file's been loaded. */
  43.     char reserved[88];    /* all zeroes on disk */
  44.     } Fli_head;
  45.  
  46. /* bit defines for flags field */
  47. #define FLI_FINISHED 1    /* finished writing fli */
  48. #define FLI_LOOPED    2    /* fli has a loop frame */
  49.  
  50. typedef struct fli_frame
  51.     {
  52.     long size;
  53.     USHORT type;        /* = 0xf1fa FLIF_MAGIC */
  54.     SHORT chunks;
  55.     char pad[8];
  56.     } Fli_frame;
  57.  
  58.  
  59. typedef struct fli_chunk
  60.     {
  61.     long size;
  62.     SHORT type;
  63.     } Fli_chunk;
  64.  
  65. typedef UBYTE Cbuf;        /* compression buffer */
  66.  
  67. /* size of buffer that'll be big enough to hold worst case FLI frame */
  68. #define FLI_CBUF_SIZE \
  69.     (64000L+3*AA_COLORS+2*sizeof(Fli_chunk)+sizeof(Fli_frame))
  70.  
  71. /* types of chunk in a fli_frame */
  72. #define FLI_COLOR 11
  73. #define FLI_LC    12
  74. #define FLI_BLACK 13
  75. #define FLI_BRUN 15
  76. #define FLI_COPY 16
  77.  
  78.  
  79. /** Higher level FLI playing functions */
  80. /* Decompress a single frame that's in RAM */
  81. void fli_uncomp(Vscreen *f, /* the screen to update */
  82.     Fli_frame *frame,        /* Header for this frame */
  83.     Cbuf *cbuf,            /* Compressed data for this frame */
  84.     Boolean see_colors);   /* update the hardware color map? */
  85.  
  86. /* Read in FLI header, verify that it's a FLI file, and return file
  87. handle.  See aaerr.h for negative return values if there are problems. */
  88. Jfile fli_open(char *fliname, Fli_head *fh);
  89.  
  90. /* Read in next frame and uncompress onto screen, optionally updating
  91. hardware color palette */
  92. Errval fli_read_display_frame(Jfile ff, Vscreen *v, Boolean see_colors);
  93.  
  94. /* Read and display next frame onto VGA display */
  95. Errval fli_next_frame(Jfile ff);
  96.  
  97. /* Play FLI, going on forever or until 'until' function returns FALSE.
  98. Until is called with the current frame, the total frame in the FLI,
  99. and how many times have played entire FLI. */
  100. Errval fli_until(char *fliname,     /* name of fli to play */
  101.     int speed,                /* if speed negative, use speed in file */
  102.     AAivec until);        /* function to call to see when to stop */
  103.  
  104. /* The 'until' function we use to construct fli_play */
  105. Boolean fli_until_key(int cur_frame, int frame_count, int cur_loop);
  106.  
  107. /* Play FLI looping forever until any key is hit */
  108. Errval fli_play(char *fliname);
  109.  
  110. /* Play FLI once */
  111. Errval fli_once(char *fliname);
  112.  
  113. #endif /* AAFLI_H */
  114.